package com.zhuannimei.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.zhuannimei.R;
import com.zhuannimei.domain.HistoryOneShop;
import com.zhuannimei.utility.JackViewHolder;
import com.zhuannimei.utility.UrlBank;

/**
 * 一元购购买记录
 * 
 * @author Jack 2014-3-6
 * 
 * 
 */
public class HistoryOneGouAdapter extends BaseObjectListAdapter {
	public HistoryOneGouAdapter(Context context, List<? extends Object> datas) {
		super(context, datas);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = View.inflate(mContext, R.layout.history_oneshop_list,
					null);
		}
		// 商品名称+期数
		TextView uschool_news_username_TV = JackViewHolder.get(convertView,
				R.id.uschool_news_username_TV);
		// 购买幸运码数量
		TextView uschool_news_content_TV = JackViewHolder.get(convertView,
				R.id.uschool_news_content_TV);
		// 商品图
		ImageView uschool_news_user_img_IV = JackViewHolder.get(convertView,
				R.id.uschool_news_user_img_IV);
		// 进行状态
		TextView uschool_news_time_TV = JackViewHolder.get(convertView,
				R.id.uschool_news_time_TV);
		HistoryOneShop hosp = (HistoryOneShop) mDatas.get(position);
		uschool_news_username_TV.setText("第" + hosp.getPhase() + "期 "
				+ hosp.getTitle());
		uschool_news_time_TV.setText("" + hosp.getStatus());
		String uri = UrlBank.getServerIp() + hosp.getPicture();
		imageLoader.displayImage(uri, uschool_news_user_img_IV, options);
		uschool_news_content_TV.setText("购买的幸运码：" + hosp.getNumber());
		return convertView;
	}

}
